﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Runtime.Remoting;
using System.Speech.Synthesis;
using System.Text;
using System.Timers;
using EasyHook;

namespace InjectorTest
{
    internal class Program
    {
        private static string _channelName;

        private static void Main(string[] args)
        {
            //int pid = int.Parse(Console.ReadLine());
            //RemoteHooking.IpcCreateServer<InjectInterface>(ref _channelName, WellKnownObjectMode.SingleCall);
            int pid = Process.GetProcessesByName("osu!")[0].Id;
            RemoteHooking.IpcCreateServer<InjectInterface>(ref _channelName, WellKnownObjectMode.SingleCall);

            RemoteHooking.Inject(pid, "Injector.dll", "Injector.dll", _channelName);
            Console.ReadLine();
        }
    }

    public class InjectInterface : MarshalByRefObject
    {
        public void IsInstalled(Int32 InClientPID)
        {
            Console.WriteLine("PID"+InClientPID);
        }
        public void OnGetBeatmapId(string beatmapId)
        {
            Console.WriteLine("Beatmap:"+beatmapId);
        }
        public void ReportException(Exception inInfo)
        {
            Console.WriteLine("Info:"+inInfo);
        }
        public void CancelDownload(string beatmapId)
        {
        }
        public void Ping()
        {
        }
    }
}
